Skip to content

Conversation

@topperc
Copy link
Collaborator

@topperc topperc commented Jul 23, 2025

No description provided.

@topperc topperc requested a review from nikic July 23, 2025 19:52
@llvmbot
Copy link
Member

llvmbot commented Jul 23, 2025

@llvm/pr-subscribers-llvm-ir

Author: Craig Topper (topperc)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/150299.diff

1 Files Affected:

  • (modified) llvm/lib/IR/Type.cpp (+6-6)
diff --git a/llvm/lib/IR/Type.cpp b/llvm/lib/IR/Type.cpp
index 5e1bf2863191c..6302614bcb357 100644
--- a/llvm/lib/IR/Type.cpp
+++ b/llvm/lib/IR/Type.cpp
@@ -324,12 +324,12 @@ IntegerType *IntegerType::get(LLVMContext &C, unsigned NumBits) {
 
   // Check for the built-in integer types
   switch (NumBits) {
-  case   1: return cast<IntegerType>(Type::getInt1Ty(C));
-  case   8: return cast<IntegerType>(Type::getInt8Ty(C));
-  case  16: return cast<IntegerType>(Type::getInt16Ty(C));
-  case  32: return cast<IntegerType>(Type::getInt32Ty(C));
-  case  64: return cast<IntegerType>(Type::getInt64Ty(C));
-  case 128: return cast<IntegerType>(Type::getInt128Ty(C));
+  case   1: return Type::getInt1Ty(C);
+  case   8: return Type::getInt8Ty(C);
+  case  16: return Type::getInt16Ty(C);
+  case  32: return Type::getInt32Ty(C);
+  case  64: return Type::getInt64Ty(C);
+  case 128: return Type::getInt128Ty(C);
   default:
     break;
   }

@github-actions
Copy link

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff HEAD~1 HEAD --extensions cpp -- llvm/lib/IR/Type.cpp
View the diff from clang-format here.
diff --git a/llvm/lib/IR/Type.cpp b/llvm/lib/IR/Type.cpp
index 6302614bc..d940b5f41 100644
--- a/llvm/lib/IR/Type.cpp
+++ b/llvm/lib/IR/Type.cpp
@@ -324,12 +324,18 @@ IntegerType *IntegerType::get(LLVMContext &C, unsigned NumBits) {
 
   // Check for the built-in integer types
   switch (NumBits) {
-  case   1: return Type::getInt1Ty(C);
-  case   8: return Type::getInt8Ty(C);
-  case  16: return Type::getInt16Ty(C);
-  case  32: return Type::getInt32Ty(C);
-  case  64: return Type::getInt64Ty(C);
-  case 128: return Type::getInt128Ty(C);
+  case 1:
+    return Type::getInt1Ty(C);
+  case 8:
+    return Type::getInt8Ty(C);
+  case 16:
+    return Type::getInt16Ty(C);
+  case 32:
+    return Type::getInt32Ty(C);
+  case 64:
+    return Type::getInt64Ty(C);
+  case 128:
+    return Type::getInt128Ty(C);
   default:
     break;
   }

@topperc topperc merged commit 71c06d7 into llvm:main Jul 23, 2025
10 of 11 checks passed
@topperc topperc deleted the pr/unneeded-cast branch July 23, 2025 21:34
mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Jul 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants